home *** CD-ROM | disk | FTP | other *** search
/ Programmers Heaven 2 / Programmers Heaven 2.iso / files / windows / ocx / ipack.exe / WHOISS.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1996-08-27  |  5.9 KB  |  181 lines

  1. VERSION 2.00
  2. Begin Form frmWhoIs 
  3.    Caption         =   "WhoIs Sample Program"
  4.    ClientHeight    =   5565
  5.    ClientLeft      =   2985
  6.    ClientTop       =   1785
  7.    ClientWidth     =   9750
  8.    Height          =   5970
  9.    Left            =   2925
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   5565
  12.    ScaleWidth      =   9750
  13.    Top             =   1440
  14.    Width           =   9870
  15.    Begin MabryWhoIs WhoIs1 
  16.       Blocking        =   -1  'True
  17.       Host            =   "whois.internic.net"
  18.       Left            =   9240
  19.       Query           =   ""
  20.       Top             =   5040
  21.    End
  22.    Begin TextBox txtQueryResults 
  23.       FontBold        =   0   'False
  24.       FontItalic      =   0   'False
  25.       FontName        =   "Courier New"
  26.       FontSize        =   8.25
  27.       FontStrikethru  =   0   'False
  28.       FontUnderline   =   0   'False
  29.       Height          =   3255
  30.       Left            =   240
  31.       MultiLine       =   -1  'True
  32.       ScrollBars      =   2  'Vertical
  33.       TabIndex        =   10
  34.       Top             =   2040
  35.       Width           =   6135
  36.    End
  37.    Begin TextBox txtQuery 
  38.       Height          =   285
  39.       Left            =   240
  40.       TabIndex        =   9
  41.       Top             =   480
  42.       Width           =   6135
  43.    End
  44.    Begin CommandButton cmdWhoIsQueryNonBlocking 
  45.       Caption         =   "WhoIs Query (Non-Blocking)"
  46.       Height          =   375
  47.       Left            =   6720
  48.       TabIndex        =   8
  49.       Top             =   240
  50.       Width           =   2775
  51.    End
  52.    Begin CommandButton cmdWhoIsQueryBlocking 
  53.       Caption         =   "WhoIs Query (Blocking)"
  54.       Height          =   375
  55.       Left            =   6720
  56.       TabIndex        =   7
  57.       Top             =   720
  58.       Width           =   2775
  59.    End
  60.    Begin CommandButton cmdExit 
  61.       Caption         =   "Exit WhoIs Sample"
  62.       Height          =   375
  63.       Left            =   6720
  64.       TabIndex        =   6
  65.       Top             =   1320
  66.       Width           =   2775
  67.    End
  68.    Begin Label Label4 
  69.       Caption         =   "Query Error Code:"
  70.       Height          =   215
  71.       Left            =   240
  72.       TabIndex        =   0
  73.       Top             =   1080
  74.       Width           =   1935
  75.    End
  76.    Begin Label Label1 
  77.       Caption         =   "WhoIs Query:"
  78.       Height          =   255
  79.       Left            =   240
  80.       TabIndex        =   1
  81.       Top             =   240
  82.       Width           =   1935
  83.    End
  84.    Begin Label Label2 
  85.       Caption         =   "Query Results:"
  86.       Height          =   255
  87.       Left            =   240
  88.       TabIndex        =   2
  89.       Top             =   1800
  90.       Width           =   1935
  91.    End
  92.    Begin Label lblErrorNumber 
  93.       BorderStyle     =   1  'Fixed Single
  94.       Height          =   285
  95.       Left            =   240
  96.       TabIndex        =   3
  97.       Top             =   1320
  98.       Width           =   6135
  99.    End
  100.    Begin Label Label3 
  101.       Caption         =   "This sample shows how to retrieve information about a particular host or net.  WhoIs typically polls the database at the InterNIC.  To try this sample, enter a host name into the WhoIs Query edit box.  Then, press one of the WhoIs Query buttons.  "
  102.       Height          =   1815
  103.       Left            =   6720
  104.       TabIndex        =   4
  105.       Top             =   2040
  106.       Width           =   2775
  107.    End
  108.    Begin Label Label5 
  109.       Caption         =   "For example, enter ""mabry.com"" into the WhoIs Query edit box.  Then, press one of the query buttons.  You'll see some technical information about our domain name come up in a few seconds."
  110.       Height          =   1335
  111.       Left            =   6720
  112.       TabIndex        =   5
  113.       Top             =   3960
  114.       Width           =   2775
  115.    End
  116. Option Explicit
  117. Sub cmdExit_Click ()
  118.     ' Get out.
  119.     End
  120.     End Sub
  121. Sub cmdWhoIsQueryBlocking_Click ()
  122.     Dim Index
  123.     ' Clear results boxes.
  124.     txtQueryResults.Text = ""
  125.     lblErrorNumber.Caption = ""
  126.     ' Start the query by getting the IP address
  127.     ' of the InterNIC's WhoIs server.  When this
  128.     ' is complete, the rest of the query is
  129.     ' handled by the WhoIs1_Done event
  130.     ' event.
  131.     Whois1.Blocking = True
  132.     Whois1.Query = txtQuery.Text
  133.     MousePointer = 11
  134.     Whois1.Action = 1
  135.     MousePointer = 0
  136.     ' Place all of the results into the Query
  137.     ' results text box.
  138.     For Index = 0 To Whois1.ResponseCount - 1
  139.         If Index <> 0 Then
  140.             txtQueryResults.Text = txtQueryResults.Text & Chr(13) & Chr(10)
  141.             End If
  142.         
  143.         txtQueryResults.Text = txtQueryResults.Text & Whois1.Response(Index)
  144.         Next Index
  145.     End Sub
  146. Sub cmdWhoIsQueryNonBlocking_Click ()
  147.     ' Clear results boxes.
  148.     txtQueryResults.Text = ""
  149.     lblErrorNumber.Caption = ""
  150.     ' Start the query by getting the IP address
  151.     ' of the InterNIC's WhoIs server.  When this
  152.     ' is complete, the rest of the query is
  153.     ' handled by the WhoIs1_Done event
  154.     ' event.
  155.     On Error Resume Next
  156.     Whois1.Blocking = False
  157.     Whois1.Query = txtQuery.Text
  158.     MousePointer = 11
  159.     Whois1.Action = 1
  160.     On Error GoTo 0
  161.     End Sub
  162. Sub WhoIs1_Done (ErrorCode As Integer)
  163.     Dim Index
  164.     lblErrorNumber = "Error code: " & ErrorCode
  165.     ' If we handled this in blocking (synchronous)
  166.     ' mode, skip the rest (no need for it).
  167.     If Whois1.Blocking Then
  168.         Exit Sub
  169.         End If
  170.     MousePointer = 0
  171.     ' Place all of the results into the Query
  172.     ' results text box.
  173.     For Index = 0 To Whois1.ResponseCount - 1
  174.         If Index <> 0 Then
  175.             txtQueryResults.Text = txtQueryResults.Text & Chr(13) & Chr(10)
  176.             End If
  177.         
  178.         txtQueryResults.Text = txtQueryResults.Text & Whois1.Response(Index)
  179.         Next Index
  180.     End Sub
  181.